home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / lib / uw_gpos.c < prev    next >
C/C++ Source or Header  |  1991-01-25  |  1KB  |  61 lines

  1. /*
  2.  *    uw library - uw_gpos, uw_spos
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8. #include "uwlib.h"
  9.  
  10. uw_gpos(uwin, pp)
  11. register UWIN uwin;
  12. register struct uwpoint *pp;
  13. {
  14.     /*
  15.      * Get the position of window "uwin" and store it in the point
  16.      * whose address is "pp".
  17.      */
  18.     if (uwin != (UWIN)0) {
  19.         if (pp != (struct uwpoint *)0) {
  20.             *pp = uwin->uwi_pos;
  21.             if (uwin->uwi_ctlfd > 0) {
  22.                 return(0);
  23.             } else {
  24.                 uwerrno = uwin->uwi_uwerr = UWE_NOCTL;
  25.                 return(-1);
  26.             }
  27.         } else {
  28.             uwerrno = uwin->uwi_uwerr = UWE_INVAL;
  29.             return(-1);
  30.         }
  31.     } else {
  32.         uwerrno = UWE_INVAL;
  33.         return(-1);
  34.     }
  35. }
  36.  
  37. uw_spos(uwin, pp)
  38. register UWIN uwin;
  39. struct uwpoint *pp;
  40. {
  41.     union uwoptval optval;
  42.  
  43.     /*
  44.      * Set the position of window "uwin" to "pp".
  45.      */
  46.     if (uwin != (UWIN)0) {
  47.         if (pp != (struct uwpoint *)0) {
  48.             uwin->uwi_pos = *pp;
  49.             optval.uwov_point.v = pp->uwp_v;
  50.             optval.uwov_point.h = pp->uwp_h;
  51.             return(uw_optcmd(uwin, UWOP_POS, UWOC_SET, &optval));
  52.         } else {
  53.             uwerrno = uwin->uwi_uwerr = UWE_INVAL;
  54.             return(-1);
  55.         }
  56.     } else {
  57.         uwerrno = UWE_INVAL;
  58.         return(-1);
  59.     }
  60. }
  61.